<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin_attach_caipu extends Admin_Controller
{
	public function __construct()
	{
		parent::__construct();
		$this->load->model('global_mdl');
		$this->global_mdl->table = 'caipu_attach';
	}

	public function index()
	{
		$this->attach_list();
	}

	public function attach_list()
	{
		$keywords = $this->input->post('keywords');
		$types = $this->input->post('types');
		$page = max(1, intval($this->input->post('pageNum')));
		$limit = 18; //每页显示数
		$offset = ($page - 1) * $limit;


		//分页
		$data['totalCount'] = 10000;
		$data['numPerPage'] = $limit;
		$data['currentPage'] = $page;
		$data['keywords'] = $keywords;
		if ($keywords)
		{
			$attach_serach = array(
				''.$types.'' => $keywords
			);
			$data['attach_list'] = $this->global_mdl->get($attach_serach, $offset, $limit)->result_array();
		}
		else
		{
			$data['attach_list'] = $this->global_mdl->get(NULL, $offset, $limit)->result_array();
		}
		
		$this->load->view('attach_caipu', $data);
	}


	public function attach_del($id = '')
	{
		$this->load->model('Attach_mdl');
		$result = $this->Attach_mdl->attach_caipu_delete($id);
		$this->_jui_message('操作成功');

	}
}

/* End of file shicai.php */
/* Location: ./application/controllers/manage/shicai.php */